package iot.ht.controller.htuserlogin;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import iot.core.annotation.Auth;
import iot.core.annotation.Log;
import iot.core.data.BaseDto;
import iot.core.data.PageData;
import iot.core.data.entity.HTUserLogin;
import iot.core.enums.AuthType;
import iot.ht.controller.htuserlogin.data.HTUserLoginDebugDto;
import iot.ht.controller.htuserlogin.data.HTUserLoginQto;
import iot.ht.controller.htuserlogin.service.IHTUserLoginService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/htuserlogin")
@Tag(name = "在线用户", description = "")
public class HTUserLoginController {
    @Autowired
    IHTUserLoginService ihtUserLoginService;


    @Auth(authType = AuthType.Login)
    @Log(logNeed = false,logTemplete ="",logPin = true,logPout = true)
    @PostMapping("/page")
    @Operation(summary = "在线用户分页", description = "")
    public  PageData<HTUserLogin> page(@RequestBody HTUserLoginQto mm){

        return ihtUserLoginService.Page(mm);
    }

    @Auth(authType = AuthType.Auth)
    @Log(logNeed = true,logTemplete ="",logPin = true,logPout = true)
    @PostMapping("/forcelx")
    @Operation(summary = "强制离线", description = "")
    public  int ForceLx(@RequestBody BaseDto mm){

        return ihtUserLoginService.ForceLx(mm);
    }


    @Auth(authType = AuthType.Auth)
    @Log(logNeed = true,logTemplete ="",logPin = true,logPout = true)
    @PostMapping("/setdebug")
    @Operation(summary = "设置调试模式", description = "")
    public  int SetDebug(@RequestBody HTUserLoginDebugDto mm){

        return ihtUserLoginService.SetDebug(mm);
    }





}
